using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Universal.Application.Repositories;
using Universal.Application.Services;

namespace Universal.Application;

/// <summary>
/// 扩展方法，用于在 Program.cs 里注册所有应用服务
/// </summary>
public static class ServiceCollectionExtension
{
    public static IServiceCollection AddApplication(this IServiceCollection services, IConfiguration configuration)
    {

        // 注册用户服务
        services.AddScoped<IUserService, UserService>();

        // 注册文件服务
        services.AddScoped<IFileService, FileService>();

        // 注册文章服务
        services.AddScoped<IArticleService, ArticleService>();

        // 注册文章分类服务
        services.AddScoped<IArticleCategoryService, ArticleCategoryService>();

        // 注册权限服务
        services.AddScoped<IPermissionService, PermissionService>();

        // 注册角色服务
        services.AddScoped<IRoleService, RoleService>();

        // 注册菜单服务
        services.AddScoped<IMenuService, MenuService>();

        // 注册认证服务
        services.AddScoped<IAuthService, AuthService>();

        services.AddScoped<ILogService, LogService>();

        return services;
    }
}